import React, {JSX, useEffect, useState} from "react";
import {View, Image} from "@tarojs/components";
import {GetRoomList, GetVipRules} from '../../api/bus'
import Card from "./com/Card/Card";
import Coupon from "./com/Coupon";
import Content from "./com/Content";
import './index.scss'
import '../../reset.scss'

const Page : React.FC = (): JSX.Element => {
  const [vipList, setVipList] = useState([]);
  const [roomList, setRoomList] = useState([]);
  const onGetRoomList = () => {
    GetRoomList().then(list => {
      setRoomList(list)
    })
  }
  const onGetVipRules = () => {
    GetVipRules().then(list => {
      setVipList(list)
    })
  }

  useEffect(() => {
    onGetRoomList();
    onGetVipRules();
  }, [])


  return (
    <View>
      <View>
        <Image src={require('@/static/images/index/Bg/index.png')}></Image>
      </View>
      <Card></Card>

      <Coupon list={vipList}></Coupon>
      <Content list={roomList}></Content>
    </View>
  );
}

export default Page;
